Skip to content

skip @ return this on RemoveReturnTagIncompatibleWithNativeTypeRector on Traits#8185

Merged
TomasVotruba merged 4 commits into
mainfrom
skip-trait-return-this-na
Jul 14, 2026
Merged

skip @ return this on RemoveReturnTagIncompatibleWithNativeTypeRector on Traits#8185
TomasVotruba merged 4 commits into
mainfrom
skip-trait-return-this-na

Conversation

@samsonasik

@samsonasik samsonasik commented Jul 14, 2026

Copy link
Copy Markdown
Member

This is valid code:

trait SkipThisReturnInTrait
{
    /**
     * @return $this
     */
    public function withVerbs(): RouteInterface
    {
        return clone $this;
    }
}

Removing @return $this cause error when it return object type.

<file name="src/AnnotatedRoutes/src/RouteLocatorListener.php">
 <error line="74" column="75" severity="error" message="UndefinedMethod: Method Spiral\Router\AbstractRoute::withMiddleware does not exist"/>
</file>

checked on spiral framework:

@samsonasik samsonasik requested a review from TomasVotruba July 14, 2026 06:27
@samsonasik

Copy link
Copy Markdown
Member Author

@TomasVotruba ready 👍

@TomasVotruba TomasVotruba merged commit d9915f2 into main Jul 14, 2026
65 checks passed
@TomasVotruba TomasVotruba deleted the skip-trait-return-this-na branch July 14, 2026 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants